/**
 * Created by 游永年 on 2019-01-13 16:13.
 * 第一次测试欢迎页面
 */

'use strict'
import React, {Component} from 'react';
import {connect} from 'dva';
import {Button, Card, Flex} from 'antd-mobile';
import style from './FirstTest.less';

class Welcome extends Component {
  render() {
    const height = window.innerHeight * 0.8;
    return (
      <Flex direction={'column'} justify={'center'} style={{height: `${height}px`}}>
        <Card full>
          <Card.Body>
            <div className={style.cardBody}>
              为了匹配适合你的老师，请先完成简单的水平测试。
            </div>
          </Card.Body>
          <Card.Footer content={this.renderFooter()}/>
        </Card>
      </Flex>
    );
  }

  renderFooter = _ => {
    return <Flex justify={'center'} className={style.twoBtnWrap}>
      <div className={style.leftBtn}>
        <Button type={'primary'} onClick={this.toTest}>
          开始测试
        </Button>
      </div>
      <div className={style.rightBtn}>
        <Button className={style.searchBtn}
                onClick={this.searchTeacher}
        >直接寻找老师
        </Button>
      </div>
    </Flex>
  }

  searchTeacher = _ => this.props.history.push('/book/bookClass');

  toTest = _ => this.props.history.push('/book/firstTest/test');

}

Welcome.propTypes = {};

export default connect()(Welcome);
